package com.maisuiit.factory.schemes02.controller;

import com.maisuiit.factory.schemes02.entity.AwardInfo;
import com.maisuiit.factory.schemes02.entity.ResponseResult;
import com.maisuiit.factory.schemes02.factory.FreeGoodsFactory;
import com.maisuiit.factory.schemes02.service.IFreeGoods;

/**
 * @author: zhangcc
 * @date: 2024/02/20
 */
public class DeliverController {

    //发放奖品
    public ResponseResult awardToUser(AwardInfo awardInfo){

        try {
            IFreeGoods freeGoods = FreeGoodsFactory.getInstance(awardInfo.getAwardType());
            ResponseResult responseResult = freeGoods.sendFreeGoods(awardInfo);
            return responseResult;
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult("201","奖品发放失败!",null);
        }
    }
}
